package datapack

import (
	"broker/interface/imodel"
	"broker/struct/model"
)

/**
 * @Description
 * @Author huan.wang
 * @Date 2021/4/25 8:16 下午
 **/

type ConnectACKDataPack struct {
}

func NewConnectACKDataPack() *ConnectACKDataPack {
	return &ConnectACKDataPack{}
}

func (c ConnectACKDataPack) Pack(message imodel.IMessage) ([]byte, error) {
	connAckMsg := message.(*model.ConnectACKMessage)
	connAckData := make([]byte, 0)
	connAckData = append(connAckData, connAckMsg.ConnACKFlag)
	connAckData = append(connAckData, connAckMsg.ConnReturnCode)

	return connAckData, nil
}

func (c ConnectACKDataPack) UnPack(bytes []byte) (*imodel.IMessage, error) {
	panic("implement me")
}
